home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-20
/
rs0422.zip
/
ROSEZSW
/
L2CONREQ.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-08-04
|
1KB
|
50 lines
/* This routine is called to validate each Level 2 Connect Request */
#include "buffer.h"
#include "iface.h"
#include "timer.h"
#include "ax25.h"
#include "ax25l2.h"
#include "data.h"
int callcmp();
extern struct ax25_addr adr[];
extern unsigned char swpos;
extern unsigned char numadr, numadrm; /* Number of addresses (callsigns) */
extern int control;
struct axcb *
l2conreq(iface) /* Returns axcb or NULL, may be a new axcb */
struct interface *iface;
{
static unsigned char i;
register unsigned char x121[8];
static struct axcb *axcb;
if (callcmp(&adr[0],&adr[1])) return NULL;
/* Can't connect to yourself! */
if (numadr < 4) /* Connect request? */ {
if (swpos != 1) return EOF; /* Not me! */
if ((axcb = open_ax25(&adr[0],&adr[1],iface,numadrm))) {
lnk_l3_pars(axcb);
}
}
else /* Call request, set up an axcb to accept the call */ {
i=swpos+2;
x121[0]=0;
l3_adr(&adr[swpos],x121);
if (x121[0] == 0) return EOF; /* No X.121 Address */
if ((x121[0] == 4) && (i<=numadr)) {
x121[0]=0;
l3_adr(&adr[swpos+1],x121);
if (x121[0]) i++;
}
if ((swpos > 4) || (i<numadr)) return EOF; /* DX */
axcb = open_ax25(&adr[0],&adr[1],iface,numadrm);
}
return axcb;
}